USE [BonData]
-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE UPDATEQUOTATION 
@QuotaIDTO int
AS
BEGIN
DECLARE @QuotIDFrom AS INT
Select @QuotIDFrom = (select Max(QuotaID) from tblQuotation);
while((select Max(QuotaID) from tblQuotation) < @QuotaIDTO)
BEGIN
	INSERT [dbo].[tblQuotation] ([QuotaCode], [Accepted], [QuotaName], [CustomerID], [SeasonID], [QuotaDate], [LastUpDate], [NoOfNights], [NoOfMeals], [NoOfFlights], [ArrivalDate], [ArrivalCity], [DepartureDate], [DepartureCity], [Region], [HFreeRoom], [HForPaid], [OFreeService], [OForPaid], [FreeCalcType], [IncNoOfPax], [MaxNoOfPax], [MinNoOfPax], [Profit], [EmployeeID], [GuideFlag], [FreeFlag], [DriverFlag], [QuotaType], [ProposalWordDoc]) VALUES (N'AYDAN', 0, N'BAYRA', 0, 1, CAST(0x00000000EF200B0000 AS DateTime2), CAST(0x00000000EF200B0000 AS DateTime2), 7, 0, NULL, NULL, NULL, NULL, NULL, NULL, 1, 20, 1, 20, 0, 5, 45, 15, 13, 3, 1, 1, 1, 0, NULL)
END
delete from tblQuotation where QuotaID > @QuotIDFrom
END
